/* 库存管理-物料管理api */

import { ajaxService } from '@/utils/request';

const env = import.meta.env;
let baseURL = env.VITE_INVENTORY_URL;
let factoryURL = env.VITE_FACTORY_URL;

// 获取物料/产品分类
export function GetClassificationList(params: any) {
  return ajaxService({
    url: '/warehouse/material/classification',
    method: 'get',
    baseURL,
    params,
  });
}

// 新增或者编辑物料/产品分类
export function PostClassificationList(data: any) {
  return ajaxService({
    url: '/warehouse/material/classification',
    method: 'post',
    baseURL,
    data,
  });
}

// 新增或者编辑物料/产品分类
export function delClassification(params: any) {
  return ajaxService({
    url: '/warehouse/material/classification',
    method: 'delete',
    baseURL,
    params,
  });
}

// 获取物料/产品管理列表
export function GetMaterialList(params: any) {
  return ajaxService({
    url: '/warehouse/material/management',
    method: 'get',
    baseURL,
    params,
  });
}
// 新增物料/产品管理列表
export function PostMaterialList(data: any) {
  return ajaxService({
    url: '/warehouse/material/management',
    method: 'post',
    baseURL,
    data,
  });
}

// 获取物料/产品管理列表
export function DelMaterialList(params: any) {
  return ajaxService({
    url: '/warehouse/material/management',
    method: 'delete',
    baseURL,
    params,
  });
}

// 获取计量单位列表数据
export function GetUnitList(params: any) {
  return ajaxService({
    url: '/warehouse/material/unit/type',
    method: 'get',
    baseURL,
    params,
  });
}

// 新增计量单位/ 编辑单计量单位
export function PostUnit(data: any) {
  return ajaxService({
    url: '/warehouse/material/unit/type',
    method: 'post',
    baseURL,
    data,
  });
}

// 编辑多计量单位
export function PutUnit(data: any) {
  return ajaxService({
    url: '/warehouse/material/more/unit',
    method: 'put',
    baseURL,
    data,
  });
}

// 删除单计量单位列表数据
export function DelSingleUnit(params: any) {
  return ajaxService({
    url: '/warehouse/material/single/unit',
    method: 'delete',
    baseURL,
    params,
  });
}

// 删除多计量单位列表数据
export function DelMultiUnit(params: any) {
  return ajaxService({
    url: '/warehouse/material/more/unit/group',
    method: 'delete',
    baseURL,
    params,
  });
}

// 删除多计量单位列表数据
export function DelUnitGroup(params: any) {
  return ajaxService({
    url: '/warehouse/material/more/unit',
    method: 'delete',
    baseURL,
    params,
  });
}

// 删除多计量单位列表数据
export function DelClassificationList(params: any) {
  return ajaxService({
    url: '/warehouse/material/management',
    method: 'delete',
    baseURL,
    params,
  });
}

// 删除多计量单位列表数据
export function getMaterialUnitAll() {
  return ajaxService({
    url: '/warehouse/material/unit/type/all',
    method: 'get',
    baseURL,
  });
}

// 单个产品管理
export function getoneMaterial(params?: any) {
  return ajaxService({
    url: '/warehouse/material/management/getone',
    method: 'get',
    params,
    baseURL,
  });
}

/**获取产品bom */
export function GetProductBomPage(data: any) {
  return ajaxService({
    url: '/factory/product/bom/page',
    method: 'get',
    params: data,
    baseURL: factoryURL,
  });
}

/**获取产品bom */
export function modSupplierMark(data: any) {
  return ajaxService({
    url: '/warehouse/material/management/supplier/mark',
    method: 'put',
    data,
    baseURL,
  });
}
